# -*- coding: utf-8 -*-#
#-------------------------------------------------------------------------------
# 建立者:        潘炎珍  
# Name:         demo07
# Description:
# Author:       98745
# Date:         2019/3/10
#-------------------------------------------------------------------------------

import json
class product:
    def __init__(self,d):
        self.__dict__=d
f=open('files/products.json','r',encoding='utf-8')
jsr=f.read()
pro=json.loads(jsr,object_hook=product)

def pd(obj):
    return {'name':obj.name,'price':obj.price,'count':obj.count}

js=json.dumps(pro,default=pd,ensure_ascii=False)
print(js)